package com.joshua.spring.datasource.creator;

import org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup;

import javax.sql.DataSource;
/**
 * projectName dragon-cloud
 * package com.joshua.spring.datasource.creator
 * classname  JndiDataSourceCreator
 * <p>
 * description JNDI数据源创建器
 * </p>
 *
 * @author <a href="mailto:joshualwork@163.com">joshua_liu</a>
 * @date 2020/11/16 10:01
 */
public class JndiDataSourceCreator {

    private static final JndiDataSourceLookup LOOKUP = new JndiDataSourceLookup();

    /**
     * 创建基础数据源
     *
     * @param name 数据源参数
     * @return 数据源
     */
    public DataSource createDataSource(String name) {
        return LOOKUP.getDataSource(name);
    }

}
